package zy.blue7.im.core.other;

import io.netty.channel.Channel;
import zy.blue7.im.common.message.EmptyMessage;
import zy.blue7.im.common.message.GroupMessage;
import zy.blue7.im.common.message.LoginMessage;
import zy.blue7.im.common.message.SingleMessage;
import zy.blue7.im.core.service.MessageHandler;
import zy.blue7.im.core.service.impl.EmptyMessageHandlerImpl;
import zy.blue7.im.core.service.impl.GroupMessageHandlerImpl;
import zy.blue7.im.core.service.impl.LoginMessageHandlerImpl;
import zy.blue7.im.core.service.impl.SingleMessageHandlerImpl;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author blue7
 * @version 1.0
 * @date 2022/3/1 16:12
 * 容器类，暂时存放 一些数据
 */
public class Container {

    public static Map<String, Channel> map = new ConcurrentHashMap<>();
    public static Map<String, List<Channel>> groupMap = new ConcurrentHashMap<>();
    public static Map<Class, MessageHandler> handlerMap = new ConcurrentHashMap<>();


    static {
        handlerMap.put(SingleMessage.class, new SingleMessageHandlerImpl());
        handlerMap.put(LoginMessage.class, new LoginMessageHandlerImpl());
        handlerMap.put(GroupMessage.class, new GroupMessageHandlerImpl());
        handlerMap.put(EmptyMessage.class, new EmptyMessageHandlerImpl());
    }

}
